package GUI;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.BorderFactory;

import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import java.sql.Connection; 
import java.sql.DriverManager; 
import java.sql.PreparedStatement; 
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.sql.Statement; 

import org.jdesktop.application.Application;

import GUI.MainPage.Action3;

import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class myMenu extends javax.swing.JFrame {
	private JPanel zero;
	private JPanel text;
	private JButton jButton7;
	private JPanel bar;
	private JPanel jPanel3;
	private JLabel jLabel3;
	private JTable jTable3;
	private JTable jTable2;
	private JTable jTable1;
	private JPanel jPanel1;
	private JButton jButton6;
	private JButton jButton5;
	private JButton jButton4;
	private JPanel jPanel2;
	private JLabel jLabel2;
	private JEditorPane jEditorPane2;
	private JPanel heading;
	


	/**
	* Auto-generated main method to display this JFrame
	*/
	public String SQL = "select * from mydb.mymenu";
	 private static Connection con = null; //Database objects 
	 private static Statement stat = null; 
	 private static ResultSet rs = null; 
	 private static PreparedStatement pst = null; 
	 
	 private static String foodname[][] = new String[5][1];
		private static double   foodprice[] = new double[100];
		private static double   calorie[]   = new double[100];
		private static double   protein[]   = new double[100];
		private static double   carbon[]    = new double[100];
		private static double   fat[]       = new double[100];
		public double totalprice = 0;
		public double totalcalorie = 0;
		private JLabel todayLabel;
		private JLabel carbonLabel3;
		private JLabel fatLabel3;
		private JLabel proteinLabel3;
		private JLabel calorieLabel3;
		private JLabel carbonLabel1;
		private JLabel fatLabel1;
		private JLabel proteinLabel1;
		private JLabel calorieLabel1;
		private JLabel carbonLabel;
		private JLabel fatLabel;
		private JLabel proteinLabel;
		private JLabel calorieLabel;
		public double totalprotein = 0;
		public double totalcarbon = 0;
		public double totalfat = 0;
		public String price ;
		public String stringcalorie ;
		public String stringprotein ;
		public String stringcarbon ;
		public String stringfat ;
	
	public static void begin()
	 {
	    try { 
		      Class.forName("com.mysql.jdbc.Driver"); 
		      con = DriverManager.getConnection( 
		      "jdbc:mysql://localhost/mydb", 
		      "root",""); 

		    } 
		    catch(ClassNotFoundException e) 
		    { 

		      System.out.println("DriverClassNotFound :"+e.toString()); 
		    }
		    catch(SQLException x) { 
		      System.out.println("Exception :"+x.toString()); 
		    } 
	 }
	 
	 public  void SelectTable() 
	 { 	
		 String select = "select * from mydb.mymenu";
		 
		 begin();
	    try 
	    { 
	      stat = con.createStatement(); 
	      rs = stat.executeQuery(select); 
	      int counting = 0;
	      
	      while(rs.next()) 
	      { 	
	    	  String present = rs.getString("foodname");
	    	  foodname[counting][0] = present;  
	    	  foodprice[counting] = rs.getInt("foodprice");
	    	  
	    	  calorie[counting] = rs.getInt("calories");
	    	  protein[counting] = rs.getInt("proteins");
	    	  carbon[counting] = rs.getInt("carbons");
	    	  fat[counting] = rs.getInt("fat");
	    	  totalprice+= foodprice[counting];
	    	  totalcalorie += calorie[counting];
	    	  totalprotein += protein[counting];
	    	  totalcarbon += carbon[counting];
	    	  totalfat += fat[counting];
	    	  counting++;
	      } 
	      price = Double.toString(totalprice);
	      stringcarbon = Double.toString(totalcarbon);
	      stringcalorie = Double.toString(totalcalorie);
	      stringprotein = Double.toString(totalprotein);
	      stringfat = Double.toString(totalfat);
	    } 
	    catch(SQLException e) 
	    { 
	      System.out.println("DropDB Exception :" + e.toString()); 
	    } 
	    finally 
	    { 
	      Close(); 
	    } 
	  } 
	 
	  private static void Close() 
	  { 
	    try 
	    { 
	      if(rs!=null) 
	      { 
	        rs.close(); 
	        rs = null; 
	      } 
	      if(stat!=null) 
	      { 
	        stat.close(); 
	        stat = null; 
	      } 
	      if(pst!=null) 
	      { 
	        pst.close(); 
	        pst = null; 
	      } 
	    } 
	    catch(SQLException e) 
	    { 
	      System.out.println("Close Exception :" + e.toString()); 
	    } 
	  } 
	
	  // End of Database setting
	
	  	
		public void compare( int size)
		{
			if(size>0)
			{
				// just for test purposes
				double StandardCalorie=2400, StandardProtein=75, StandardFat=73, StandardCarbohydrate=360;
			
				// Now, calcuate total/Standard
				double ratioCalorie= totalcalorie/StandardCalorie;
				double ratioProtein= totalprotein/StandardProtein;
				double ratioFat= totalfat/StandardFat;
				double ratioCarbohydrate= totalcarbon/StandardCarbohydrate;
				calorieLabel1.setText(" Calorie ");
				int calorie_next = 0;
				if(ratioCalorie>=1.5) 
				{
					calorieLabel.setText(" consumption much higher ");
					calorieLabel.setForeground(Color.red);
				}
				else if (ratioCalorie>=1.35){
					calorieLabel.setText(" consumption significantly higher ");
					calorieLabel.setForeground(Color.red);
				}
				else if (ratioCalorie>=1.2){
					calorieLabel.setText(" consumption slightly higher ");
					calorieLabel.setForeground(Color.red);
				}
				else if (ratioCalorie<=0.5){
					calorieLabel.setForeground(Color.blue);
					calorieLabel.setText(" consumption much less ");
				}
				else if (ratioCalorie<=0.65){
					calorieLabel.setForeground(Color.blue);
					calorieLabel.setText(" consumption significantly less ");
				}
				else if (ratioCalorie<=0.8){
					calorieLabel.setForeground(Color.blue);
					calorieLabel.setText(" consumption slightly less ");
				}
				else{
					calorieLabel.setForeground(Color.green);
					calorieLabel.setText(" nice!!");
					calorie_next = 1;
				}
				if(calorie_next ==0)
				{
					double different = 0;
					if(totalcalorie>StandardCalorie)
					{
						different = totalcalorie - StandardCalorie;
						String message =  Double.toString(different);
						calorieLabel3.setText(" than standard level by "+ message);
					}
					else
					{
						different = StandardCalorie - totalcalorie;
						String message =  Double.toString(different);
						calorieLabel3.setText(" than standard level by "+ message);
					}			
				}
				proteinLabel1.setText(" Protein ");
				int protein_next = 0;
				if(ratioProtein>=1.5){
					proteinLabel.setForeground(Color.red);
					proteinLabel.setText(" consumption much higher ");
				}
				else if (ratioProtein>=1.35){
					proteinLabel.setForeground(Color.red);
					proteinLabel.setText(" consumption significantly higher ");
				}
				else if (ratioProtein>=1.2){
					proteinLabel.setForeground(Color.red);
					proteinLabel.setText(" consumption slightly higher ");
				}
				else if (ratioProtein<=0.5){
					proteinLabel.setForeground(Color.blue);
					proteinLabel.setText(" consumption much less ");
				}
				else if (ratioProtein<=0.65){
					proteinLabel.setForeground(Color.blue);
					proteinLabel.setText(" consumption significantly less ");
				}
				else if (ratioProtein<=0.8){
					proteinLabel.setForeground(Color.blue);
					proteinLabel.setText(" consumption slightly less ");
				}
				else{
					proteinLabel.setForeground(Color.green);
					proteinLabel.setText(" nice!!");
					protein_next = 1;
				}
				if(protein_next == 0)
				{
					double different = 0;
					if(totalprotein>StandardProtein)
					{
						different = totalprotein - StandardProtein;
						String message =  Double.toString(different);
						proteinLabel3.setText(" than standard level by "+ message);
					}
					else
					{
						different = StandardProtein - totalprotein;
						String message =  Double.toString(different);
						proteinLabel3.setText(" than standard level by "+ message);
					}			
				}
				fatLabel1.setText(" Fat ");
				int fat_next = 0;

				if(ratioFat>=1.5){
					fatLabel.setForeground(Color.red);
					fatLabel.setText(" consumption much higher ");
				}
				else if (ratioFat>=1.35){
					fatLabel.setForeground(Color.red);
					fatLabel.setText(" consumption significantly higher ");
				}
				else if (ratioFat>=1.2){
					fatLabel.setForeground(Color.red);
					fatLabel.setText(" consumption slightly higher ");
				}
				else if (ratioFat<=0.5){
					fatLabel.setForeground(Color.blue);
					fatLabel.setText(" consumption much less ");
				}
				else if (ratioFat<=0.65){
					fatLabel.setForeground(Color.blue);
					fatLabel.setText(" consumption significantly less ");
				}
				else if (ratioFat<=0.8){
					fatLabel.setForeground(Color.blue);
					fatLabel.setText(" consumption slightly less ");
				}
				else{
					fatLabel.setForeground(Color.green);
					fatLabel.setText(" nice!!");
					fat_next = 1;
				}
				if(fat_next==0)
				{
					double different = 0;
					if(totalfat>StandardFat)
					{
						different = totalfat - StandardFat;
						String message =  Double.toString(different);
						fatLabel3.setText(" than standard level by "+ message);
					}
					else
					{
						different = StandardFat - totalfat ;
						String message =  Double.toString(different);
						fatLabel3.setText(" than standard level by "+ message);
					}			
				}
			
				int carbon_next = 0;
				carbonLabel1.setText("Carbo ");

				if(ratioCarbohydrate>=1.5){
					carbonLabel.setForeground(Color.red);
					carbonLabel.setText("  consumption much higher ");
				
				}
				else if (ratioCarbohydrate>=1.35){
					carbonLabel.setForeground(Color.red);
					carbonLabel.setText("  consumption significantly higher ");
				}
				else if (ratioCarbohydrate>=1.2){
					carbonLabel.setForeground(Color.red);
					carbonLabel.setText("  consumption slightly higher ");
				}
				else if (ratioCarbohydrate<=0.5){
				carbonLabel.setForeground(Color.blue);
				carbonLabel.setText("  consumption much less ");
				}
				else if (ratioCarbohydrate<=0.65){
				carbonLabel.setForeground(Color.blue);
				carbonLabel.setText("  consumption significantly less ");
				}
				else if (ratioCarbohydrate<=0.8){
				carbonLabel.setForeground(Color.blue);
				carbonLabel.setText("  consumption slightly less ");
				}
				else{
				carbonLabel.setForeground(Color.green);
				carbonLabel.setText("  nice!!");
				carbon_next = 1;
				}
				if(carbon_next ==0 )
				{
					double different = 0;
					if(totalcarbon>StandardCarbohydrate)
					{
						different = totalcarbon - StandardCarbohydrate;
						String message =  Double.toString(different);
						carbonLabel3.setText(" than standard level by "+ message);
					}
					else
					{
						different = StandardCarbohydrate - totalcarbon;
						String message =  Double.toString(different);
						carbonLabel3.setText(" than standard level by "+ message);
					}			
				}
			}
			
		}
		
	
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				myMenu inst = new myMenu();
				inst.setLocationRelativeTo(null);
				
				inst.setVisible(true);
			}
		});
	}
	
	public myMenu() {
		super();
		
		initGUI();
	}
	
	

    
	class RMenu implements ActionListener{    
		public void actionPerformed(ActionEvent e){
			MainPage inst = new MainPage();
			inst.setVisible(true);
			dispose();
			}}
	 class Action2 implements ActionListener{    
		public void actionPerformed(ActionEvent e){

			}}
	class Search implements ActionListener{    
		public void actionPerformed(ActionEvent e){
			search frame = new search();
			frame.setVisible(true);
			dispose();
			}}
	
	 class ActionAsk implements ActionListener{    
		public void actionPerformed(ActionEvent e){
			compare(5);
			}}

	
	private void initGUI() {
		try {
			
			GridBagLayout thisLayout = new GridBagLayout();
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			thisLayout.rowWeights = new double[] {0.0, 0.1};
			thisLayout.rowHeights = new int[] {50, 7};
			thisLayout.columnWeights = new double[] {0.0, 0.1};
			thisLayout.columnWidths = new int[] {105, 7};
			getContentPane().setLayout(thisLayout);

			{
				zero = new JPanel();
				getContentPane().add(zero, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
				zero.setName("zero");

			}
			{
				heading = new JPanel();
				getContentPane().add(heading, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
				heading.setName("heading");
				{
					jLabel2 = new JLabel();
					heading.add(jLabel2);
					jLabel2.setName("jLabel2");
					jLabel2.setText("My Menu");
					jLabel2.setPreferredSize(new java.awt.Dimension(355, 32));
				}
			}
			{
				text = new JPanel();
				BoxLayout textLayout = new BoxLayout(text, javax.swing.BoxLayout.Y_AXIS);
				text.setLayout(textLayout);
				getContentPane().add(text, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				jEditorPane2 = new JEditorPane();
				getContentPane().add(jEditorPane2, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				jEditorPane2.setName("jEditorPane2");
				/*{
					todayLabel = new JLabel();
					getContentPane().add(todayLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 100, 0, 20), 0, 0));
					todayLabel.setName("todayLabel");
					todayLabel.setText("Today");
				}*/
			}
			{
				jPanel2 = new JPanel();
				GridBagLayout jPanel2Layout = new GridBagLayout();
				getContentPane().add(jPanel2, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(30, 0, 0, 0), 0, 0));
				jPanel2.setName("jPanel2");
				jPanel2Layout.rowWeights = new double[] {0.0, 0.1, 0.1, 0.1};
				jPanel2Layout.rowHeights = new int[] {199, 7};
				jPanel2Layout.columnWeights = new double[] {0.0, 0.0};
				jPanel2Layout.columnWidths = new int[] {60, 353};
				//SelectTable();
				jPanel2.setLayout(jPanel2Layout);
				{
					jPanel1 = new JPanel();
					jPanel2.add(jPanel1, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					jPanel1.setName("jPanel1");
					//////////////////////////////////////////////////////////////////////
					SelectTable();
		/////////////////////////////////////////////////////////////////////////////////////////////////////
					{
						TableModel jTable1Model = 
								new DefaultTableModel(
										/*new String[][] { { " My menu food" }, { "Tuna Fish Hot Baked Potatoes" },{"Deep Fried Scallop with edd ayonnaise salad"},{"Egg Fu-Young"}, },*/
										foodname,
										new String[] {  "Column 2" }
										);
						jTable1 = new JTable();
						jPanel1.add(jTable1);
						jTable1.setModel(jTable1Model);
						jTable1.setPreferredSize(new java.awt.Dimension(290, 96));
						jTable1.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						jTable1.setName("jTable1");    
					}
					{
						
						TableModel jTable3Model = 
								new DefaultTableModel(
										new String[][] { { "calorie","protein","fat","carbohydate"  }, { stringcalorie +" kcal",stringprotein+" g",stringfat+" g",stringcarbon+" g"} },
										new String[] { "Column 1", "Column 2", "Column 1","Column 1" });
						jTable3 = new JTable();
						jPanel1.add(jTable3);
						jTable3.setModel(jTable3Model);
						jTable3.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						jTable3.setPreferredSize(new java.awt.Dimension(328, 33));
						jTable3.setName("jTable3");
					}
					{
						TableModel jTable2Model = 
								new DefaultTableModel(
										new String[][] { { "price"}, { "$"+price } },
										new String[] { "Column 2" });
						jTable2 = new JTable();
						jPanel1.add(jTable2);
						jTable2.setModel(jTable2Model);
						jTable2.setPreferredSize(new java.awt.Dimension(58, 32));
						jTable2.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
						jTable2.setName("jTable2");
					}
					{
						jButton4 = new JButton();
						jPanel1.add(jButton4);
						jButton4.setName("jButton4");
						jButton4.addActionListener(new ActionAsk());   
						jButton4.setText("Ask Advice");
					}
				}
				{
					jLabel3 = new JLabel();
					jPanel2.add(jLabel3, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(60, 0, 0, 0), 0, 0));
					jLabel3.setName("jLabel3");
					//jLabel3.setText("My Menu");
				}
				{
					calorieLabel = new JLabel();
					jPanel2.add(calorieLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
					//calorieLabel.setText("calorie");
					calorieLabel.setName("calorieLabel");
				}
				{
					proteinLabel = new JLabel();
					jPanel2.add(proteinLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(-200, 0, 0, 0), 0, 0));
					//proteinLabel.setText("protein");
					proteinLabel.setName("proteinLabel");
				}
				{
					fatLabel = new JLabel();
					jPanel2.add(fatLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(-120, 0, 0, 0), 0, 0));
					//1fatLabel.setText("fat");
					fatLabel.setName("fatLabel");
				}
				{
					carbonLabel = new JLabel();
					jPanel2.add(carbonLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(-50, 0, 0, 0), 0, 0));
					//carbonLabel.setText("carbon");
					carbonLabel.setName("carbonLabel");
				}
				{
					calorieLabel1 = new JLabel();
					jPanel2.add(calorieLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
					calorieLabel1.setName("calorielabel1");
					//calorieLabel1.setText("calorie1");
				}
				{
					proteinLabel1 = new JLabel();
					jPanel2.add(proteinLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(-200, 0, 0, 0), 0, 0));
					proteinLabel1.setName("proteinLabel1");
					//proteinLabel1.setText("protein1");
				}
				{
					fatLabel1 = new JLabel();
					jPanel2.add(fatLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(-120, 0, 0, 0), 0, 0));
					fatLabel1.setName("fatLabel1");
					//fatLabel1.setText("fat1");
				}
				{
					carbonLabel1 = new JLabel();
					jPanel2.add(carbonLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(-50, 0, 0, 0), 0, 0));
					carbonLabel1.setName("carbonLabel1");
					//carbonLabel1.setText("carbon1");
				}
				{
					calorieLabel3 = new JLabel();
					jPanel2.add(calorieLabel3, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
					calorieLabel3.setName("calorieLabel3");
					//calorieLabel3.setText("calorie3");
				}
				{
					proteinLabel3 = new JLabel();
					jPanel2.add(proteinLabel3, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(-200, 0, 0, 0), 0, 0));
					proteinLabel3.setName("proteinLabel3");
					//proteinLabel3.setText("p3");
				}
				{
					fatLabel3 = new JLabel();
					jPanel2.add(fatLabel3, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(-120, 0, 0, 0), 0, 0));
					fatLabel3.setName("fatLabel3");
					//fatLabel3.setText("f3");
				}
				{
					carbonLabel3 = new JLabel();
					jPanel2.add(carbonLabel3, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(-50, 0, 0, 0), 0, 0));
					carbonLabel3.setName("carbonLabel3");
					//carbonLabel3.setText("c3");
				}
				
			}
			{
				jPanel3 = new JPanel();
				BoxLayout jPanel3Layout = new BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS);
				jPanel3.setLayout(jPanel3Layout);
				getContentPane().add(jPanel3, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
				jPanel3.setName("jPanel3");

				{
					bar = new JPanel();
					int red = 120;  
					int green = 255;  
					int blue = 0;  
					Color myBlue = new Color(red,green,blue);  
					bar.setBackground(myBlue); 
					jPanel3.add(bar, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					GridBagLayout barLayout = new GridBagLayout();
					barLayout.columnWidths = new int[] {7};
					barLayout.rowHeights = new int[] {40, 40, 40, 40, 40, 40};
					barLayout.columnWeights = new double[] {0.1, 0.1, 0.1, 0.1};
					barLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1};
					bar.setLayout(barLayout);
					bar.setName("bar");
					{
						jButton5 = new JButton();
						bar.add(jButton5, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
						jButton5.setName("jButton1");
						jButton5.addActionListener(new RMenu()); 
						jButton5.setText("Restaurant Menu");
 
						jButton5.setBackground(myBlue); 
					}
					{
						jButton6 = new JButton();
						bar.add(jButton6, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
						jButton6.setName("jButton2");
						jButton6.setText("My Menu");
						jButton6.setBackground(myBlue); 
					}
					{
						jButton7 = new JButton();
						bar.add(jButton7, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
						jButton7.setName("jButton3");
						jButton7.addActionListener(new Search()); 
						jButton7.setText("Search");
						jButton7.setBackground(myBlue); 
					}
				}
			}

			pack();
			this.setSize(650, 600);
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(getContentPane());
		} catch (Exception e) {
		    //add  error handling code here
			e.printStackTrace();
		}
	}

}
